<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/7/16
  Time: 15:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>显示</title>
</head>

<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
    $(function () {
        $("#uname").blur(function () {
            var uname = $(this).val();
            $.post("/testuname","username="+uname,function (rs) {
                //转换成可以处理的js
                rs=eval("("+rs+")");
                if (rs.username.length>0){
                    $("#uname").val(rs.username);
                    $("#phone").val(rs.phone);
                    $("#age").val(rs.age);
                    $("#sp").html("");
                }else{
                    $("#sp").html("账户名未存在");
                    $("#age").val("");
                }

            });
        });
    })

</script>
<body>

名字:<input type="text" id="uname"><span id="sp"></span><br>
电话:<input type="text" id="phone"><br>
年龄:<input type="text" id="age">
</body>
</html>
